package com.jiazhong.boot.rocketmq.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "consumer_group_e", topic = "TopicB",
        selectorExpression = "sync", messageModel = MessageModel.BROADCASTING)
public class MyConsumerListener implements RocketMQListener<String> {

    public MyConsumerListener() {
        log.info("MyConsumerListener init");
    }

    @Override
    public void onMessage(String s) {
        log.info("消费者开始执行了");
        log.info("消费的内容是：{}", s);
    }
}
